import React, {
	Component,
	useEffect,
} from "react";
import {
	StatusBar,
} from 'react-native';

export function useSetBackground(props) {
	useEffect(() => {
		StatusBar.setBackgroundColor('#ffffff');

		const didFocus = props.navigation.addListener('didFocus', () => {
			setTimeout(() => {
				StatusBar.setBackgroundColor('#ffffff');
			});
		});

		const willBlur = props.navigation.addListener('willBlur', () => {
			StatusBar.setBackgroundColor('#f6db7b');
		});

		return () => {
			didFocus.remove();
			willBlur.remove();
		};
	}, []);
}